package entity;

import java.io.Serializable;
import java.sql.Time;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import util.enumeration.OperatingDay;
import util.enumeration.OperatingHours;

@Entity(name = "OperatingHour")
@Inheritance(strategy = InheritanceType.JOINED)
public class OperatingHoursEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private OperatingDay operatingDayEnum;
    private String operatingDay;
    private OperatingHours openingHoursEnum;
    private Time openingHours;
    private OperatingHours closingHoursEnum;
    private Time closingHours;
    @ManyToOne
    private BranchEntity branch;

    public OperatingHoursEntity() {
    }

    public OperatingHoursEntity(OperatingHoursEntity operatingHoursEntity) {
        this.operatingDayEnum = operatingHoursEntity.getOperatingDayEnum();
        this.operatingDay = operatingHoursEntity.getOperatingDay() ;
        this.openingHoursEnum = operatingHoursEntity.getOpeningHoursEnum();
        this.openingHours = operatingHoursEntity.getOpeningHours();
        this.closingHoursEnum = operatingHoursEntity.getClosingHoursEnum();
        this.closingHours = operatingHoursEntity.getClosingHours();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOperatingDay() {
        return operatingDay;
    }

    public void setOperatingDay(String operatingDay) {
        this.operatingDay = operatingDay;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OperatingHoursEntity)) {
            return false;
        }
        OperatingHoursEntity other = (OperatingHoursEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.BusinessDetail[ id=" + id + " ]";
    }

    public BranchEntity getBranch() {
        return branch;
    }

    public void setBranch(BranchEntity branch) {
        this.branch = branch;
    }

    public OperatingHours getOpeningHoursEnum() {
        return openingHoursEnum;
    }

    public void setOpeningHoursEnum(OperatingHours openingHoursEnum) {
        this.openingHoursEnum = openingHoursEnum;
    }

    public OperatingHours getClosingHoursEnum() {
        return closingHoursEnum;
    }

    public void setClosingHoursEnum(OperatingHours closingHoursEnum) {
        this.closingHoursEnum = closingHoursEnum;
    }

    public Time getOpeningHours() {
        return openingHours;
    }

    public void setOpeningHours(Time openingHours) {
        this.openingHours = openingHours;
    }

    public Time getClosingHours() {
        return closingHours;
    }

    public void setClosingHours(Time closingHours) {
        this.closingHours = closingHours;
    }

    
    public OperatingDay getOperatingDayEnum() {
        return operatingDayEnum;
    }

    public void setOperatingDayEnum(OperatingDay operatingDayEnum) {
        this.operatingDayEnum = operatingDayEnum;
    }
}
